/*
 * Copyright (C) 2005-2024 Giorgio Maone <https://maone.net>
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 */

 @import url("./common.css");

.opt-group {
  display: flex;
  flex-flow: row wrap;
  padding: .5em 0;
}

:is(section, .opt-group) ~ :is(.opt-group, section, fieldset) {
  border-top: 2px solid var(--tab-color1);
}

fieldset > .opt-group ~ .opt-group {
  border: none;
}

.opt-group > span {
  margin: 0 .5em;
  display: flex;
  flex-flow: row;
  align-items: baseline;
}

.opt-group input[type="radio"] ~ label
{
  margin-right: 1em;
}

@media (max-width: 550px) {

  .sites td.url {
    vertical-align: top;
  }

  #sites .presets {
    width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    padding-bottom: 1em !important;
  }

  #presets .presets input.preset {
    min-width: 28vw;
  }

  #sites .presets input.preset {
     min-width: 0 !important;
     margin-top: 0;
     margin-left: 0;
     margin-right: 1em;
     font-weight: bold;
  }

  #sites .presets input.preset:checked {
    filter: drop-shadow(0 0 2px var(--fg-color1));
  }

  #sites .site:not(.customizing) .presets input.preset {
    background-color: transparent;
    background-position: center;
  }

  #sites .customizing input.preset:checked  {
    margin-left: 0;
  }

  #presets .presets input.preset + label {
    font-size: 80%;
    --line-scaled: calc(var(--line-size) / 0.8);
    position: absolute !important;
    text-align: left;
    margin: 0px !important;
    display: block !important;
    overflow: visible;
    bottom: 0px;
  }

   #sites .presets input.preset:checked + label {
    z-index: 1000;
    font-size: 60%;
    left: 0;
    width: auto;
    top: calc(var(--line-size) * 1.8);
    margin: 0 !important;
    padding: 0 !important;
    text-align: center !important;
    display: block !important;
    position: absolute;
    overflow: visible !important;
    background: none !important;
  }

  .presets input.preset:checked ~ input.temp {
    left: var(--line-size);
    right: auto;
    pointer-events: none;
  }

  .customizing input.preset:checked ~ input.temp {
    pointer-events: all !important;
    z-index: 1000;
    padding: calc(var(--line-size) / 2);
  }

  #sites .customizing input.preset:checked + label {
    pointer-events: none;
    transition: all .2s;
  }

  td.presets {
    white-space: nowrap !important;
    vertical-align: middle;
    border: 1px solid var(--fg-color2);
  }
  .url > span > span {
    white-space: wrap;
    word-break: break-all;
    letter-spacing: -0.2mm;
    font-size: 80%;
   }

   .contextual fieldset {
     padding-top: 1.5em;
   }
}


.site.filtered, .site.filtered + .customizer {
  display: none;
}

#sites .customizing .presets {
  padding-bottom: 0 !important;
  margin-bottom: 0 !important;
  vertical-align: bottom;
}

.capsContext, .capsContext > div {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.capsContext > label, .capsContext button {
  display: block;
  margin: 0.5em;
}

.capsContext select {
  display: none;
  margin: 0.5em;
  max-width: 32em;
}

.contextual .capsContext select {
  display: initial;
}

.pageTurn {
  position: absolute;
  outline: 3px solid #888;
  z-index: 1000;
  background-color: var(--bg-color2);
  transform-origin: bottom center;
  transition: transform .5s;
}

.pageTurn.endgame {
  transform: scale(.5, .1);
}

input[type="text"] {
  border: 1px solid;
}
input[type="checkbox"] {
  width: 1em;
  height: 1em;
}

.presets {
  -moz-user-select: none;
  user-select: none;
}
.sites {
  border: 0;
  border-collapse: collapse;
  border-spacing: 0;
  width: 100%;
  image-rendering: -webkit-optimize-contrast;
  --extra-preset-width: 0px;
}

.vintage .sites {
  image-rendering: auto;
}

.sites tr, .sites td {
  margin: 0;
  padding: 0;
  border: none;
  font-size: 1em;
  vertical-align: middle;
}

html:not(.mobile) .sites > tr.site:not(.customizing):is(:focus-within) {
  background-image: var(--bg-focused-row);
  border-color: transparent;
}

.sites > tr.site:not(.customizing) {
  border-top: var(--border-row-sep);
}

.sites > tr.site:nth-of-type(even) {
  background-color: var(--bg-even-row);
}

.sites > tr.site:nth-of-type(odd) {
  background-color: var(--bg-odd-row);
}


.sites > tr.site:first-of-type, tr.site:focus-within + tr, .sites > tr.customizing, .sites > tr.customizing + tr.site, .customizer, .customizer + tr.site  {
  border-color: transparent;
}


.site .url {
    padding: 0 0 0 0.5em;
    color: var(--fg-color2);
    width: 80%;
}
.site .url .protocol { display: none }

.site .url .domain { cursor: help }

[data-key="host"] .full-address span .protocol,
[data-key="domain"] .full-address span .host,
[data-key="domain"] .full-address span .protocol {
  border: none;
}


.site .url[data-key="domain"] .domain,
.site .url[data-key="host"] .domain,
.site .url[data-key="host"] .sub,
.site .url[data-key="unsafe"] span {
  color: var(--unsafe-color)
}

.site .url[data-key="secure"] .domain,
.site .url[data-key="secure"] .sub,
.site .url[data-key="full"] span {
  color: var(--fg-color2)
}

.site .url[data-key="full"] span,
.site .url[data-key="unsafe"] span {
  display: initial;
}

.site .url .domain {
  font-weight: bold;
}

.site.tabLess .full-address::after {
  content: attr(data-tabLess);
  display: inline-block;
  padding-inline: .5em;
}

input.https-only {
  font-size: 100%;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background: var(--img-ui-http) no-repeat center;
  background-size: 1.5em;
  background-position: bottom;
  width: 2em;
  height: 2em;
  margin: -.25em 0;
  padding:0;
  cursor: pointer;
}
input.https-only:checked {
  background-image: var(--img-ui-https);
}
label.https-only {
  display: none;
}

.preset label.preset.override {
  color: var(--text-color);
}

[data-preset="UNTRUSTED"] .https-only, [data-preset="DEFAULT"] .https-only {
  visibility: hidden;
}


td.presets {
  font-size: 1em;
  white-space: nowrap;
}

span.preset {
  position: relative;
  display: inline-block;
  font-size: 1em;
  height: var(--line-size);
  top: 0.1em;
}

.preset label, .preset input, .preset button {
  cursor: pointer;
}

.presets input.preset {
  font-size: 1em;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background: transparent var(--img-ui-no) no-repeat center;
  outline: 0;
  opacity: .7;
  margin: 0 1em 0 0;
  background-position: 0;
  background-size: var(--line-size);
  width: var(--line-size);
  height: var(--line-size);
  position: relative;
  z-index: 1;
}

#presets-sizer {
  visibility: hidden;
  position: absolute;
  display: block;
  width: 5000px;
  height: 500px;
  top: -5000px;

}

#presets-sizer span.preset {
  display: block;
}

.presets input.preset:checked, #presets input.preset, #presets-sizer input.preset {
  opacity: 1;
  transform: none;
  min-width: calc(var(--preset-label-width) + var(--line-size) * 1.5 + var(--extra-preset-width));
}

.presets input.preset:focus {
  transform: none;
}
.sites input + label {
  font-size: 1em;
  vertical-align: baseline;
}

.presets label.preset {
  letter-spacing: -0.06em;
  width: 0;
  overflow: hidden;
  display: none;
  text-transform: uppercase;
  color: var(--fg-color2);
  opacity: .8;
  position: absolute;
  left: 0;
  padding: .05em 0.4em 0 0;
  --line-scaled: var(--line-size);
  line-height: var(--line-scaled);
  padding-left: calc(var(--line-scaled) * 1.4);
}

.presets input.preset[value^="T"] + label {
  text-transform: none;
}

.presets input.preset:checked + label, #presets .presets label {
  opacity: 1;
  display: inline-flex;
  width: var(--preset-label-width);
  background-color: var(--form-color2);
  border-radius: 1em 1em 0 0;
}


@media (min-width: 550px) {
  :not(#presets) > .sites .site:not(.customizing) .presets input.preset:checked + label.preset {
    background-color: var(--bg-preset-color);
    border-radius: calc(var(--line-size) / 2);
    box-shadow: 0 0 1px var(--fg-color1);
  }
}

#presets :is(.presets input.preset + label, .customizer-controls) {
  box-shadow: 0 0 .2em var(--fg-color1);
}

#presets-sizer .presets label {
   position: absolute;
   display: inline;
   width: auto;
   overflow: visible;
   padding: 0;
}

input.preset[value="T_TRUSTED"] {
  background-image: var(--img-ui-temp);
}

input.preset[value="TRUSTED"], input.preset.canScript {
  background-image: var(--img-ui-yes)
}
input.preset[value="UNTRUSTED"] {
  background-image: var(--img-ui-black)
}
input.preset[value="CUSTOM"] {
  background-image: var(--img-ui-custom)
}

input.temp {
  font-size: 1em;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  outline: 0;
  background: var(--img-ui-clock) no-repeat center;
  background-size: 60%;
  width: 1.5em;
  height: 1.5em;
  transition: 0.2s all;
  right: 0;
  top: 0;
  pointer-events: none;
  position: absolute;
  z-index: 100;
}

input.temp + label {
  display: none;
}

input.temp + label {
  display: none;
}

input.preset:checked ~ input.temp {
  opacity: .7;
  right: calc(var(--extra-preset-width) - .5em);
  pointer-events: all;
}

.customizing input.preset:checked ~ input.temp {
  right: .5em;
}

.presets input.preset:checked ~ input.temp:checked {
 opacity: 1 !important;
 background-size: 100%;
}

.customizing input.preset:checked, #presets input.preset:checked {
  filter: none;
}

.customizer fieldset {
  background-color: var(--form-color2);
  margin: 0;
  box-shadow: var(--form-color1) 0 2px 2px;
  position: relative;
}

.customizing input.preset:checked {
  margin: 0 0 -0.2em 0;
  background-position: 0 0;
}

span.preset.CUSTOM {
  --extra-preset-width: 2em;
}

#presets span.preset {
  margin-right: .8em;
  max-width: 28vw;
}

#presets :is(input.preset, input.preset:checked) {
  filter: none;
  background-position: .2em 0;
}

#presets .site.customizing {
  background-color: transparent;
}

#presets .customizing input.preset:not(:checked) + label {
  margin-bottom: 0;
  background-color: var(--form-color1);
}

#presets legend select, #presets legend button {
  display: none;
}

.caps {
  display: flex;
  align-content: start;
  flex-wrap: wrap;
  clear: both;
  padding: .5em;
}

#presets .customizer fieldset {
  margin-top: 0px;
}

.customizer.closed .customizer-controls   {
  height: 0;
  overflow: hidden;
}

span.cap {
  padding: 0.3em;
  margin: 0.2em;
  border-radius: .4em;
  font-weight: normal;
  display: inline-flex;
  align-items: center;
}

span.cap.needed {
  font-weight: bold;
  color: var(--fg-color2);
  background-color: var(--hilite-color);
}

#noscript-popup span.cap.extra:not(.needed, .checked),
#noscript-options span.cap.extra:not(.belongs, .checked)
{
  display: none;
}


span.cap

fieldset {
  border: 0;
  padding: 1em;
  margin: 0;
}

legend {
  font-weight: bold;
  display: block;
}

.customizer legend {
  font-size: 1em;
  float: left;
}

#presets .url {
  display: none;
}

#high-contrast-chooser {
  display: none;
}

.hilite {
  background-color: #850 !important;
}
.hilite-end {
  transition: background-color 1s;
}
.hilite .url {
  transform: scale(2);
  transition: none;
}
.hilite-end .url {
  transform: none;
  transition: transform 1s;
}

#xssChoices {
  padding: .5em;
  display: none;
}

#xssChoices.populated {
  display: block;
}

#xssChoices select {
  display: block;
  margin: 0 0 .5em 0;
}

#xssChoices option {
  background: var(--bg-color2);
}

#xssChoices option.block {
  color: var(--accent-color);
}

#xssChoices option.allow {
  color: var(--text-color);
}
